/**
 * StringBufferDemo: creeaza acelasi String in trei moduri diferite.
 */
public class StringBufferDemo{
 public static void main (String[] argv){
  String s1 = "Hello" + "," + "Word";
  System.out.println(s1);

//construieste un StringBuffer, si aplica unele lucruri la el.
  StringBuffer sb2 = new StringBuffer();
  sb2.append("Hello");
  sb2.append(',');
  sb2.append(' ');
  sb2.append("World");
//ia valoarea lui StringBuffer ca si un String si il afiseaza
  String s2 = sb2.toString();
  System.out.println(s2);

  StringBuffer sb3 = new StringBuffer().append("Hello").append(',').
      append(' ').append("Word");
  System.out.println(sb3.toString());
 }
} 
